package com.keller.dao;

import com.keller.domian.Permission;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PermissionDao {

    @Select("select * from permission where id in (select permissionid from role_permission where roleid=#{roleId})")
    public List<Permission> findPermissionByRoleId(String roleId);

    @Select("select * from permission")
    public List<Permission> findAllPermission();

    @Insert("insert into permission (permissionName,url) values (#{permissionName},#{url})")
    public void savePermission(Permission permission);
}
